const webpack = require('webpack');
const { merge } = require('webpack-merge');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin');

const commonWebpack = require('./webpack.common')

module.exports = merge(commonWebpack, {
  mode: 'production',
  devtool: 'none',
  optimization: {
    sideEffects: true,
    usedExports: true,
    splitChunks: {
      chunks: 'all'
    }
  },
  plugins: [
    new webpack.DefinePlugin({
      BASE_URL: "'/'",
      'process.env': "'production'"
    }),    
    new CleanWebpackPlugin(),
    new HtmlWebpackPlugin({
      template: './public/index.html',
      title: 'test',
      minify: true
    }),
    new CopyWebpackPlugin([
      'public'
    ]),
    new VueLoaderPlugin(),
  ]
});